﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    Inherits="masterdata_Taxes_Type_List" CodeFile="Taxes_Type_List.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>税率列表</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: '税率维护',
                iconCls: 'icon-ok',
                closed: true,
                buttons: [{
                    text: '保存',

                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '返回',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            }); dlg.parent().appendTo(jQuery("form:first"));
        });
        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }

    </script>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table id="wsd_listtable" width="100%">
                <tr>
                    <td style="width: 100%">
                        <asp:GridView Width="100%" ID="GridView1" DataKeyNames="ID" runat="server" AutoGenerateColumns="False"
                            BorderWidth="0" OnRowDataBound="Grid_RowDataBound" EmptyDataText="没有可显示的数据."
                            EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                            EnableEmptyContentRender="true" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                            AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="15"
                            EnableModelValidation="True"  GridLines="None">
                            <HeaderStyle CssClass="titlist" />
                            <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                            <Columns>
                                <asp:TemplateField HeaderText="描述" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center"
                                    ShowHeader="False" ItemStyle-Width="40%">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClientClick="open1();"
                                            CommandName="Select" Text='<%# Eval("DESCRIPTION") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                    <ControlStyle Font-Underline="False" />
                                    <ItemStyle Width="40%" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="税率值" ItemStyle-HorizontalAlign="Center" ShowHeader="False"
                                    ItemStyle-Width="40%">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" CommandName="Select"
                                            Text='<%# Eval("TAXES1", "{0:N2}") %>' OnClientClick="open1()"></asp:LinkButton>
                                    </ItemTemplate>
                                    <ControlStyle Font-Underline="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="有效">
                                    <ItemTemplate>
                                        <b>
                                            <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%>
                                        </b>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings Visible="false" FirstPageText="首页" LastPageText="尾页" Mode="NumericFirstLast"
                                PageButtonCount="30" />
                            <RowStyle CssClass="evenline" />
                            <AlternatingRowStyle CssClass="oddline" />
                        </asp:GridView>
                        <uc1:GridPager ID="GridPager1" runat="server" />
                    </td>
                </tr>
            </table>
            <br />
            <table id="wsd_inputtable">
                <tr>
                    <td height="10px" class="tabletitle">
                        操作选项
                    </td>
                </tr>
                <tr>
                    <td class="buttonarea" style="height: 39px">
                        <asp:Button ID="Button1" runat="server" class="wsd_button2" OnClick="Button1_Click"
                            OnClientClick="open1()" Text="新  增" CausesValidation="false" />
                    </td>
                </tr>
            </table>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div id="dd" icon="icon-save" style="width: 350px; height: 200px;">
        <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <table id="Table2" style="width: 100%; text-align: center;">
                    <tr>
                        <td class="tabletitle" style="width: 100%; text-align: left;">
                            <font color="red" size="2"><b>提示:*为必填项</b></font>
                        </td>
                        <td class="tabletitle">
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable" style="border: 0px;">
                    <tr>
                        <td>
                            <center>
                              <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
                                    DefaultMode="Insert" OnDataBound="DetailsView1_DataBound"
                                    BorderWidth="0px" GridLines="None" EnableModelValidation="True">
                             
                                <Fields>
                                   
                                    <asp:TemplateField HeaderText="<font color=red>*</font>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述:">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtName" runat="server" MaxLength="15" Text='<%# Bind("Description") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="描述不能为空"
                                                ControlToValidate="txtName" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<font color=red>*</font>税率值:">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtTax" runat="server" MaxLength="4" Text='<%# Bind("TAXES1") %>'></asp:TextBox>
                                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="税率值不能为空"
                                                ControlToValidate="txtTax" Display="Dynamic"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" Display="Dynamic" runat="server" ErrorMessage="税率值应为数字"
                                                ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtTax"></asp:RegularExpressionValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="&nbsp;&nbsp;有&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;效:" >
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="chkValid" Checked='<%# Bind("active") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                                <RowStyle CssClass="tablefield" />
                            </asp:DetailsView>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.TAXES"
                                InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.MasterData.TaxesManager"
                                UpdateMethod="Save">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            </center>
                        </td>
                    </tr>
                </table>
                <div style="display: none; width: 1000px;">
                    <table id="Table3" style="width: 100%">
                        <tr>
                            <td height="10px" width="100%" class="tabletitle">
                                操作选项
                            </td>
                        </tr>
                        <tr>
                            <td class="buttonarea" style="height: 39px">
                                <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />&nbsp;&nbsp;
                                <asp:Button ID="btnCancel" runat="server" class="wsd_button2" Text="取  消" CausesValidation="false"
                                    OnClientClick="close1()" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
